import request from '@/utils/request'

/* 获取员工列表的接口 */
export const fetchEmployeeListAPI = (pageParams) => {
  return request({
    url: '/park/sys/user',
    method: 'GET',
    params: pageParams
  })
}

/* 重置密码的接口 */
export const resetPasswordAPI = (id) => {
  return request({
    url: '/park/sys/user/resetPwd',
    method: 'PUT',
    data: {
      id
    }
  })
}

/* 删除员工的接口 */
export const deleteEmployeeAPI = (id) => {
  return request({
    url: `/park/sys/user/${id}`,
    method: 'DELETE'
  })
}

/* 添加或者修改员工的接口 */
export const addOrUpdateEmployeeAPI = (data) => {
  if (data.id) {
    return request({
      url: `/park/sys/user`,
      method: 'PUT',
      data
    })
  } else {
    return request({
      url: `/park/sys/user`,
      method: 'POST',
      data
    })
  }
}

/* 获取所有角色列表的接口 */
export const fetchRoleListAPI = () => {
  return request({
    url:"/park/sys/role",
    method:"GET",
  })
}
